package uni.UNIBEE7B8D.view.User.seeting;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import uni.UNIBEE7B8D.BaseActivity;
import uni.UNIBEE7B8D.R;
import uni.UNIBEE7B8D.view.User.SeetingEdit.SexActivity;
import uni.UNIBEE7B8D.view.User.SeetingEdit.UserNameActivity;

public class SeetingActivity extends BaseActivity implements View.OnClickListener {

    @BindView(R.id.back)
    ImageView back;
    @BindView(R.id.exit)
    TextView exit;
    @BindView(R.id.head)
    RelativeLayout head;
    @BindView(R.id.nameView)
    LinearLayout nameView;
    @BindView(R.id.sexView)
    LinearLayout sexView;
    @BindView(R.id.mobileView)
    LinearLayout mobileView;
    @BindView(R.id.pwdView)
    LinearLayout pwdView;
    @BindView(R.id.zizhiView)
    LinearLayout zizhiView;
    private SharedPreferences sharedPreferences;
    private SharedPreferences.Editor editor;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_seeting);
        ButterKnife.bind(this);

        exit.setOnClickListener(this);
        sharedPreferences = getSharedPreferences("kangconfig", Activity.MODE_PRIVATE);
        editor = sharedPreferences.edit();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.exit:
                editor.clear();
                editor.commit();
                finish();
                break;
        }
    }

    @OnClick({R.id.head, R.id.nameView, R.id.sexView, R.id.mobileView, R.id.pwdView, R.id.zizhiView})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.head:
                break;
            case R.id.nameView:
                Intent intent = new Intent(getBaseContext(), UserNameActivity.class);
                startActivity(intent);
                break;
            case R.id.sexView:
                Intent intent1 = new Intent(getBaseContext(), SexActivity.class);
                startActivity(intent1);
                break;
            case R.id.mobileView:
                break;
            case R.id.pwdView:
                break;
            case R.id.zizhiView:
                break;
        }
    }

    @OnClick(R.id.back)
    public void onViewClicked() {
        finish();
    }
}
